package Experiments;

import humanDetector.AbstractHumanDetector;
import humanDetector.BasicHumanDetector;

import java.util.List;

import org.apache.commons.lang3.time.DurationFormatUtils;
import org.apache.commons.lang3.time.StopWatch;

import classifiers.AbstractClassifier;
import classifiers.SVMLinear;

import au.com.bytecode.opencsv.CSVReader;

import pdi.IO.CSVImgReader;
import pdi.IO.ImgReader;
import pdi.IO.SeqImgReader;
import pdi.core.Image;


public class TrainHumanDetector {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		
		String featureFile = "./data/hogFeatures.csv";		
		String saveModelPath = "./model/model_1";
		
		StopWatch stp = new StopWatch();
		stp.start();
		
		ImgReader  reader = new  CSVImgReader(featureFile);
		List<Image> featuredImages = reader.readAll();
		
		System.out.println(DurationFormatUtils.formatDuration(stp.getTime(), "HH:mm:ss.SS"));
		
		AbstractClassifier classifier  = new SVMLinear();		
		AbstractHumanDetector hd = new BasicHumanDetector(null, null, null, classifier);
				
		try {
			hd.train(featuredImages);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}		
	}

}
